using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using PccCommonForC;

public partial class Pub_Ajax_AjaxAutoComplete : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Expires = -1;
        Response.ContentType = "text/plain";
        ProcessPage(Request.QueryString["type"]);
        Response.End();    
    }
    private void ProcessPage(string type)
    {
        Response.Write(fnSearch());
    }
    private string fnSearch()
    {
        clsWebShop cls = new clsWebShop();
        DataTable dt;
        string sql = "", str = "";
       /* if (Request.QueryString["TopicID"] != "0")
            sql += "  and t.TopicID=" + Request.QueryString["TopicID"];
        if (Request.QueryString["CatID"] != "0")
            sql += "  and c.CatID=" + Request.QueryString["CatID"];*/

        /*dt = cls.GetData("select replace(replace(PDName,'\',''),'/','')PDName from Product p inner join Catalogue c on c.CatID=p.CatID inner join Topic t on t.TopicID=c.TopicID  where PDName like N'%" + Request.QueryString["q"] + "%'  and p.Status<>'D'  " + sql + " order by ViewCount").Tables[0];*/

      /* dt = cls.GetData("select replace(replace(PDName,'\',''),'/','')PDName from Product p inner join Catalogue c on c.CatID=p.CatID  where PDName like N'%" + Request.QueryString["q"] + "%'  and p.Status<>'D'  " + " order by c.KindNo Desc").Tables[0];*/
        PccMsg msg=new PccMsg();
        msg.CreateFirstNode("PdName", Request.QueryString["q"] );
        msg.CreateFirstNode("CatID", "0");
        msg.CreateFirstNode("TopicID", "0");
        dt = cls.Get_ProductByCondition(msg.GetXmlStr).Tables[0];

        foreach (DataRow row in dt.Rows)
        {
            str += row["PDName"].ToString() + "\n";
        }
        return str;
    }
}
